<?php
namespace Admin\Common;
use Think\Controller;


// 后台公共类 哪个控制器需要权限控制就加上权限继承
class CommonController extends Controller {
    public function _initialize(){
       //声明Auth认证类 
    	$auth = new \Think\Auth();

    	$userid = $_SESSION['id'];

    	$rulename = MODULE_NAME . '/'.CONTROLLER_NAME.'/'. ACTION_NAME;

    	// var_dump($rulename,$userid);
        if ($userid==18) {
            $auth->check($rulename,$userid);
        }elseif(!$auth->check($rulename,$userid)){
    		$this->error('你没有权限访问',U('Admin/login/index'),1);
    		exit;
    	};

    }





}
